package com.cskaoyan.weixin.controller;

import com.cskaoyan.bean.BaseRespVo;

import com.cskaoyan.service.CommentService;
import com.cskaoyan.weixin.bean.comment.CommentCountVO;
import com.cskaoyan.weixin.bean.comment.CommentListVO;
import com.cskaoyan.weixin.service.CommentWxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx/comment")
public class CommentWxController {

    @Autowired
    CommentWxService commentService;

    @RequestMapping("count")
    public BaseRespVo commentCount(Integer valueId, Byte type){
        CommentCountVO commentCountVO = commentService.countOfComment(valueId, type);
        System.out.println(commentCountVO);
        return BaseRespVo.ok(commentCountVO);
    }

    @RequestMapping("list")
    public BaseRespVo commentList(Integer valueId, Byte type, Integer size,
                                  Integer page, Byte showType){

        CommentListVO commentListVO = commentService.queryCommentOfGoods(valueId, type, size, page, showType);
        System.out.println(commentListVO);
        return BaseRespVo.ok(commentListVO);
    }
}
